home *** CD-ROM | disk | FTP | other *** search
- Path: news.bridge.net!news
- From: David Byrden <100101.2547@compuserve.com>
- Newsgroups: comp.lang.c++
- Subject: Re: const member functions
- Date: 14 Jan 1996 04:29:03 GMT
- Organization: self-employed
- Message-ID: <4da0qf$6v3@news.bridge.net>
- References: <4d8d8f$b30@oznet07.ozemail.com.au>
- NNTP-Posting-Host: ppp-mia2-95.bridge.net
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
-
-
- Oliver;
-
- A member function marked 'const' will not modify any of the
- data members of its object; this is enforced by C++. This
- includes not calling non-const member functions.
-
- The idea is that when you declare a class object const,
- you will truly be unable to modify it. However, the
- compiler cannot prevent you modifying other resources that the
- class object owns, such as heap memory, and so you need
- to program carefully in order to design clases which are
- truly "const-corect".
-
- David
-
-
-